﻿using SBlogCore.Common.FluentValidatorExtend;
using SBlogCore.WebAdminApplication.SysUserManager.Dto;

namespace SBlogCore.WebAdminApplication.SysManager.Dto
{
    public class SysOpenJobUpdateInPut : SysOpenJobInPut
    {
        public long Id { get; set; }
    }

    public class SysOpenJobInPut
    {
        public string? JobId { get; set; }
        /// <summary>
        /// 任务名称
        /// </summary>
        public string? JobName { get; set; }
        /// <summary>
        /// 任务执行方式0：本地任务；1：外部接口任务
        /// </summary>
        public int JobType { get; set; }
        /// <summary>
        /// 任务地址
        /// </summary>
        public string? JobCall { get; set; }
        /// <summary>
        /// 任务参数，JSON格式
        /// </summary>
        public string? JobCallParams { get; set; }
        /// <summary>
        /// CRON表达式
        /// </summary>
        public string? Cron { get; set; }
    }
    public class SysOpenJobInPutValidator : SblogCoreAbstractValidator<SysOpenJobInPut>
    {
        public SysOpenJobInPutValidator()
        {
            RuleFor(x => x.JobId).NotNull().WithMessage("任务ID不能为空");
            RuleFor(x => x.JobName).NotNull().WithMessage("任务名称不能为空");
            RuleFor(x => x.JobCall).NotNull().WithMessage("任务地址不能为空");
            RuleFor(x => x.Cron).NotNull().WithMessage("Cron公式不能为空");
        }
    }
}
